
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>Flume · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="jsoup.html" />
    
    
    <link rel="prev" href="scrapy.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    前言
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" >
            
                <span>
            
                    
                    平台搭建
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../build/jdkmysql.html">
            
                <a href="../build/jdkmysql.html">
            
                    
                    jdk、mysql安装、环境变量配置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../build/1.hadoop伪分布式部署.html">
            
                <a href="../build/1.hadoop伪分布式部署.html">
            
                    
                    HADOOP伪分布式搭建
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../build/2.hadoop全分布式部署.html">
            
                <a href="../build/2.hadoop全分布式部署.html">
            
                    
                    HADOOP完全分布式搭建
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="../build/hadoopha.html">
            
                <a href="../build/hadoopha.html">
            
                    
                    hadoopHa介绍
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.5" data-path="../build/3.hadoopha部署.html">
            
                <a href="../build/3.hadoopha部署.html">
            
                    
                    HADOOPHA搭建
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.6" data-path="../build/4.hive组件部署.html">
            
                <a href="../build/4.hive组件部署.html">
            
                    
                    HIVE搭建
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.7" data-path="../build/5.sqoop组件部署.html">
            
                <a href="../build/5.sqoop组件部署.html">
            
                    
                    SQOOP搭建
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.8" data-path="../build/6.hbase组件部署.html">
            
                <a href="../build/6.hbase组件部署.html">
            
                    
                    HBASE搭建
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.9" data-path="../build/7.flume组件部署.html">
            
                <a href="../build/7.flume组件部署.html">
            
                    
                    FLUME搭建
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.10" data-path="../build/8.spark组件部署.html">
            
                <a href="../build/8.spark组件部署.html">
            
                    
                    SPARK搭建
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.11" data-path="../build/9.kafka组件部署.html">
            
                <a href="../build/9.kafka组件部署.html">
            
                    
                    KAFKA搭建
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.12" data-path="../build/10.storm组件部署.html">
            
                <a href="../build/10.storm组件部署.html">
            
                    
                    STORM搭建
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.13" data-path="../build/11.zookeeper组件部署.html">
            
                <a href="../build/11.zookeeper组件部署.html">
            
                    
                    ZOOKEEPER搭建
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" >
            
                <span>
            
                    
                    数据采集
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="requests+pymysql.html">
            
                <a href="requests+pymysql.html">
            
                    
                    requsts+pymysql
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="scrapy.html">
            
                <a href="scrapy.html">
            
                    
                    Scrapy
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.3.3" data-path="flume采集本地文件到hdfs.html">
            
                <a href="flume采集本地文件到hdfs.html">
            
                    
                    Flume
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="jsoup.html">
            
                <a href="jsoup.html">
            
                    
                    Jsoup
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="http://wpa.qq.com/msgrd?v=3&uin=903563099&site=qq&menu=yes" target="blank" class="gitbook-link">
            联系我吧
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >Flume</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="&#x6D4B;&#x8BD5;&#x73AF;&#x5883;">&#x6D4B;&#x8BD5;&#x73AF;&#x5883;</h1>
<p>Centos7 + hadoop&#x5B8C;&#x5168;&#x5206;&#x5E03;&#x5F0F; + JDK8 + flume</p>
<pre><code># Name the components on this agent
a2.sources = r2
a2.sinks = k2
a2.channels = c2

# Describe/configure the source
a2.sources.r2.type = exec
a2.sources.r2.command = tail -F /opt/module/hive/logs/hive.log
a2.sources.r2.shell = /bin/bash -c

# Describe the sink
a2.sinks.k2.type = hdfs
a2.sinks.k2.hdfs.path = hdfs://hadoop102:9000/flume/%Y%m%d/%H
#&#x4E0A;&#x4F20;&#x6587;&#x4EF6;&#x7684;&#x524D;&#x7F00;
a2.sinks.k2.hdfs.filePrefix = logs-
#&#x662F;&#x5426;&#x6309;&#x7167;&#x65F6;&#x95F4;&#x6EDA;&#x52A8;&#x6587;&#x4EF6;&#x5939;
a2.sinks.k2.hdfs.round = true
#&#x591A;&#x5C11;&#x65F6;&#x95F4;&#x5355;&#x4F4D;&#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x65B0;&#x7684;&#x6587;&#x4EF6;&#x5939;
a2.sinks.k2.hdfs.roundValue = 1
#&#x91CD;&#x65B0;&#x5B9A;&#x4E49;&#x65F6;&#x95F4;&#x5355;&#x4F4D;
a2.sinks.k2.hdfs.roundUnit = hour
#&#x662F;&#x5426;&#x4F7F;&#x7528;&#x672C;&#x5730;&#x65F6;&#x95F4;&#x6233;
a2.sinks.k2.hdfs.useLocalTimeStamp = true
#&#x79EF;&#x6512;&#x591A;&#x5C11;&#x4E2A;Event&#x624D;flush&#x5230;HDFS&#x4E00;&#x6B21;
a2.sinks.k2.hdfs.batchSize = 1000
#&#x8BBE;&#x7F6E;&#x6587;&#x4EF6;&#x7C7B;&#x578B;&#xFF0C;&#x53EF;&#x652F;&#x6301;&#x538B;&#x7F29;
a2.sinks.k2.hdfs.fileType = DataStream
#&#x591A;&#x4E45;&#x751F;&#x6210;&#x4E00;&#x4E2A;&#x65B0;&#x7684;&#x6587;&#x4EF6;
a2.sinks.k2.hdfs.rollInterval = 600
#&#x8BBE;&#x7F6E;&#x6BCF;&#x4E2A;&#x6587;&#x4EF6;&#x7684;&#x6EDA;&#x52A8;&#x5927;&#x5C0F;
a2.sinks.k2.hdfs.rollSize = 134217700
#&#x6587;&#x4EF6;&#x7684;&#x6EDA;&#x52A8;&#x4E0E;Event&#x6570;&#x91CF;&#x65E0;&#x5173;
a2.sinks.k2.hdfs.rollCount = 0
#&#x6700;&#x5C0F;&#x5197;&#x4F59;&#x6570;
a2.sinks.k2.hdfs.minBlockReplicas = 1

# Use a channel which buffers events in memory
a2.channels.c2.type = memory
a2.channels.c2.capacity = 1000
a2.channels.c2.transactionCapacity = 100

# Bind the source and sink to the channel
a2.sources.r2.channels = c2
a2.sinks.k2.channel = c2
</code></pre><p>&#x6267;&#x884C;&#x76D1;&#x63A7;&#x914D;&#x7F6E;</p>
<pre><code> bin/flume-ng agent --conf conf/ --name a2 --conf-file job/flume-file-hdfs.con
</code></pre>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="scrapy.html" class="navigation navigation-prev " aria-label="Previous page: Scrapy">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="jsoup.html" class="navigation navigation-next " aria-label="Next page: Jsoup">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"Flume","level":"1.3.3","depth":2,"next":{"title":"Jsoup","level":"1.3.4","depth":2,"path":"spider/jsoup.md","ref":"spider/jsoup.md","articles":[]},"previous":{"title":"Scrapy","level":"1.3.2","depth":2,"path":"spider/scrapy.md","ref":"spider/scrapy.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":["livereload"],"pluginsConfig":{"livereload":{},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"spider/flume采集本地文件到hdfs.md","mtime":"2019-12-06T02:06:40.617Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-12-06T01:48:49.248Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

